package org.sbbs.app.security.service.impl;

import java.util.Iterator;
import java.util.List;

import org.sbbs.app.security.dao.UrlSecurityResourceDao;
import org.sbbs.app.security.model.UrlSecurityResource;
import org.sbbs.app.security.service.UrlSecurityResourceManager;
import org.sbbs.base.service.impl.BaseManagerImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("urlSecurityResourceManager")
public class UrlSecurityResourceManagerImpl
		extends
			BaseManagerImpl<UrlSecurityResource, Long>
		implements
			UrlSecurityResourceManager {
	private UrlSecurityResourceDao urlSecurityResourceDao;

	@Autowired
	public UrlSecurityResourceManagerImpl(
			UrlSecurityResourceDao urlSecurityResourceDao) {
		super(urlSecurityResourceDao);
		this.urlSecurityResourceDao = urlSecurityResourceDao;
	}

	@Override
	public void initUrlResourceRepo(List resList) {
		// this.urlSecurityResourceDao.clearUrlResourceRepo();
		for (Iterator iterator = resList.iterator(); iterator.hasNext();) {
			UrlSecurityResource res = (UrlSecurityResource) iterator.next();
			this.urlSecurityResourceDao.save(res);
		}
	}
}
